package moodish.comm.component;

import java.io.IOException;
import java.net.UnknownHostException;

import org.junit.Test;

public class AllTests {

	
	
	@Test	
	public  void test_connect() throws UnknownHostException, IOException, InterruptedException {
	
		/**
		 * Create an instance of the ServerCommComponent. 
		 */	
		
		ServerCommComponent testServerCommComponent = new ServerCommComponent();		
		
		/**
		 * Create an instance of the ClientCommComponent. 
		 */	
		
		ClientCommComponent testClientCommComponent = new ClientCommComponent();	
		
		
		/**
		 * Test the several public methods. 
		 */	
		testServerCommComponent.start();
		
		testClientCommComponent.connect("localhost", "Miguel");
	/*	
		testClientCommComponent.connect("localhost", "Luis");
		
		testClientCommComponent.connect("localhost", "Ricardo");
		
		testClientCommComponent.isConnected();
		
		testClientCommComponent.sendMoodishMessage("hello world");
			
		testClientCommComponent.friendship("Ricardo");
		
		testClientCommComponent.friendship("Luis");
		
		testClientCommComponent.unfriendship("Ricardo");
		
		testClientCommComponent.hasNextMessage();
		
		testServerCommComponent.sendMoodishMessage("Miguel", "Luis", "Hi there :)");
		
		testServerCommComponent.disconnectClient("Ricardo");
		
		testServerCommComponent.disconnectClient("Luis");
		
		testServerCommComponent.clientIsConnected("Luis");
		
		testServerCommComponent.clientIsConnected("Miguel");
		
		testClientCommComponent.disconnect();
		
		testServerCommComponent.getNextMessage();
		
		testServerCommComponent.getNextMessage();
		
		testServerCommComponent.hasNextMessage();
		*/
		
		
		
		
		//testClientCommComponent.getNextMessage();
		
		//testServerCommComponent.hasNextMessage();
		
		//testClientCommComponent.sendMoodishMessage(null);
		
		
		//testServerCommComponent.getNextMessage();
		
		//testServerCommComponent.sendNewFriendship("Miguel", "Luis");
		
		//testServerCommComponent.sendNewUnfriendship("Miguel", "Ricardo");
		
		//testServerCommComponent.sendError("Miguel", "error test");
		
		
		
		//testClientCommComponent.disconnect();
		//testServerCommComponent.shutdown();
	
	/*	
		testServerCommComponent.wait(1);
		testServerCommComponent.notify();
		testServerCommComponent.notifyAll();
		testServerCommComponent.sendError("toNickname", "error");
		
		
		testServerCommComponent.sendClientConnected("toNickname", "connectedNickname");
		testServerCommComponent.sendClientDisconnected("toNickname", "disconnectedNickname");
		testServerCommComponent.clientIsConnected("nickname");
		testServerCommComponent.disconnectClient("nickname");
		testServerCommComponent.getNextMessage();
		
		a= testServerCommComponent.hasNextMessage();
		
	*/	
		
		
		
		
	
		
		
		
		
		

	}
	
	
	
	
}
